home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 34 / Amiga Format CD34 (1998-11-20)(Future Publishing)(GB)[!][Christmas issue].iso / -seriously_amiga- / programming / basic / blitzc2p / c2p / c2p060only.ascii < prev    next >
Text File  |  1998-10-01  |  6KB  |  404 lines

  1. WBStartup
  2. NoCli
  3.  
  4. ; 030/50 results:
  5.  
  6. ; 320x200 @27.9fps PAL
  7. ; 320x256 @21.5fps PAL
  8.  
  9. ; 040/25 results:
  10.  
  11. ; 320x200 @46.0fps DoublePAL or 48.2fps PAL
  12. ; 320x256 @34.2fps DoublePAL or 37.4fps PAL
  13. ; 320x240 @37.1fps DoublePAL or 40.1fps PAL
  14.  
  15. ; 060/50 results:
  16.  
  17. ; 320x256 @50fps PAL
  18. ; 320x200 @66fps PAL
  19.  
  20. #c2pBPLX=320
  21. #c2pBPLY=256
  22. #c2pBPLSIZE=(#c2pBPLX*#c2pBPLY)/8
  23.  
  24. #scrwidth=#c2pBPLX
  25. #scrheight=#c2pBPLY
  26. #screensize=#scrwidth*#scrheight
  27.  
  28. ; c2p1x1_8_c5_060
  29.  
  30. Statement c2p060onlyinit{A.l,B.l}
  31.  
  32.   ;A.l=d0=Width.w
  33.   ;B.l=d0=Height.w
  34.  
  35. ; d0.w  chunkyx [chunky-pixels]
  36. ; d1.w  chunkyy [chunky-pixels]
  37. ; d3.w  scroffsy [screen-pixels]
  38.  
  39.   MOVEQ.l #0,d3 ; Y offset
  40.  
  41. c2p1x1_8_c5_060_init
  42.   LEA c2p_data(pc),a0
  43.   ANDI.l  #$ffff,d0
  44.   MULU.w  d0,d3
  45.   LSR.l #3,d3
  46.   MOVE.l  d3,c2p_scroffs-c2p_data(a0)
  47.   MULU.w  d0,d1
  48.   MOVE.l  d1,c2p_pixels-c2p_data(a0)
  49. AsmExit
  50. End Statement
  51.  
  52. Statement c2p060only{A.l,B.l}
  53.  
  54.   MOVE.l  d0,a0 ; Chunky
  55.   MOVE.l  d1,a1 ; Planar
  56.  
  57. ; a0  c2pscreen
  58. ; a1  bitplanes
  59.  
  60. c2p1x1_8_c5_060
  61.   MOVE.w  #_xend-_x,d0
  62.  
  63.   MOVEM.l a3-a6,-(a7)
  64.  
  65.   LEA c2p_data(pc),a2
  66.  
  67.   ADD.w #c2pBPLSIZE,a1
  68.   ADD.l c2p_scroffs-c2p_data(a2),a1
  69.  
  70.   MOVE.l  c2p_pixels-c2p_data(a2),a3
  71.   ADD.l a0,a3
  72.  
  73.   MOVE.l  a1,a2
  74.   ADD.l #c2pBPLSIZE*4,a2
  75.  
  76.   CMP.l a0,a3
  77.   BEQ _none
  78.  
  79.   MOVE.l  (a0)+,d0
  80.   MOVE.l  (a0)+,d1
  81.   MOVE.l  (a0)+,d2
  82.   MOVE.l  (a0)+,d3
  83.  
  84.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  85.   MOVE.l  d1,d6
  86.   MOVE.l  d3,d7
  87.   LSR.l #4,d6
  88.   LSR.l #4,d7
  89.   EOR.l d0,d6
  90.   EOR.l d2,d7
  91.   AND.l d5,d6
  92.   AND.l d5,d7
  93.   EOR.l d6,d0
  94.   EOR.l d7,d2
  95.   LSL.l #4,d6
  96.   LSL.l #4,d7
  97.   EOR.l d6,d1
  98.   EOR.l d7,d3
  99.  
  100.   MOVE.l  d0,a4
  101.   MOVE.l  d1,a5
  102.   MOVE.l  d2,a6
  103.   MOVE.l  d3,d5
  104.  
  105.   MOVE.l  (a0)+,d0
  106.   MOVE.l  (a0)+,d1
  107.   MOVE.l  (a0)+,d2
  108.   MOVE.l  (a0)+,d3
  109.  
  110.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  111.   MOVE.l  d3,d7
  112.   LSR.l #4,d6
  113.   LSR.l #4,d7
  114.   EOR.l d0,d6
  115.   EOR.l d2,d7
  116.   AND.l #$0f0f0f0f,d6
  117.   AND.l #$0f0f0f0f,d7
  118.   EOR.l d6,d0
  119.   EOR.l d7,d2
  120.   LSL.l #4,d6
  121.   LSL.l #4,d7
  122.   EOR.l d6,d1
  123.   EOR.l d7,d3
  124.  
  125.   EXG d1,a4
  126.   EXG d3,a6
  127.  
  128.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  129.   MOVE.w  d2,d7
  130.   MOVE.w  d1,d0
  131.   MOVE.w  d3,d2
  132.   SWAP  d0
  133.   SWAP  d2
  134.   MOVE.w  d0,d1
  135.   MOVE.w  d2,d3
  136.   MOVE.w  d6,d0
  137.   MOVE.w  d7,d2
  138.  
  139.   BRA _start
  140. _x
  141.   MOVE.l  (a0)+,d0
  142.   MOVE.l  (a0)+,d1
  143.   MOVE.l  (a0)+,d2
  144.   MOVE.l  (a0)+,d3
  145.  
  146.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  147.  
  148.   MOVE.l  #$0f0f0f0f,d5   ; Swap 4x1, parts 1 & 2
  149.   MOVE.l  d1,d6
  150.   MOVE.l  d3,d7
  151.   LSR.l #4,d6
  152.   LSR.l #4,d7
  153.   EOR.l d0,d6
  154.   EOR.l d2,d7
  155.   AND.l d5,d6
  156.   AND.l d5,d7
  157.   MOVE.l  a6,-c2pBPLSIZE(a1)
  158.   EOR.l d6,d0
  159.   EOR.l d7,d2
  160.   LSL.l #4,d6
  161.   LSL.l #4,d7
  162.   EOR.l d6,d1
  163.   EOR.l d7,d3
  164.  
  165.   MOVE.l  a5,d7
  166.  
  167.   MOVE.l  d0,a4
  168.   MOVE.l  d1,a5
  169.   MOVE.l  d2,a6
  170.   MOVE.l  d3,d5
  171.  
  172.   MOVE.l  (a0)+,d0
  173.   MOVE.l  (a0)+,d1
  174.   MOVE.l  (a0)+,d2
  175.   MOVE.l  (a0)+,d3
  176.  
  177.   MOVE.l  d7,(a1)+
  178.  
  179.   MOVE.l  d1,d6     ; Swap 4x1, parts 3 & 4
  180.   MOVE.l  d3,d7
  181.   LSR.l #4,d6
  182.   LSR.l #4,d7
  183.   EOR.l d0,d6
  184.   EOR.l d2,d7
  185.   AND.l #$0f0f0f0f,d6
  186.   AND.l #$0f0f0f0f,d7
  187.   EOR.l d6,d0
  188.   EOR.l d7,d2
  189.   LSL.l #4,d6
  190.   LSL.l #4,d7
  191.   EOR.l d6,d1
  192.   EOR.l d7,d3
  193.  
  194.   EXG d1,a4
  195.   EXG d3,a6
  196.  
  197.   MOVE.w  d0,d6     ; Swap 16x4, parts 1 & 3
  198.   MOVE.w  d2,d7
  199.   MOVE.w  d1,d0
  200.   MOVE.w  d3,d2
  201.   SWAP  d0
  202.   SWAP  d2
  203.   MOVE.w  d0,d1
  204.   MOVE.w  d2,d3
  205.   MOVE.w  d6,d0
  206.   MOVE.w  d7,d2
  207.  
  208.   MOVE.l  d4,c2pBPLSIZE-4(a1)
  209. _start
  210.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 1 & 3
  211.   MOVE.l  d0,d6
  212.   MOVE.l  d2,d7
  213.   LSR.l #2,d6
  214.   LSR.l #2,d7
  215.   EOR.l d1,d6
  216.   EOR.l d3,d7
  217.   AND.l d4,d6
  218.   AND.l d4,d7
  219.   EOR.l d6,d1
  220.   EOR.l d7,d3
  221.   LSL.l #2,d6
  222.   LSL.l #2,d7
  223.   EOR.l d6,d0
  224.   EOR.l d7,d2
  225.  
  226.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 1 & 3
  227.   MOVE.l  d2,d6
  228.   MOVE.l  d3,d7
  229.   LSR.l #8,d6
  230.   LSR.l #8,d7
  231.   EOR.l d0,d6
  232.   EOR.l d1,d7
  233.   AND.l d4,d6
  234.   AND.l d4,d7
  235.   EOR.l d6,d0
  236.   EOR.l d7,d1
  237.   LSL.l #8,d6
  238.   LSL.l #8,d7
  239.   EOR.l d6,d2
  240.   EOR.l d7,d3
  241.  
  242.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 1 & 3
  243.   MOVE.l  d2,d6
  244.   MOVE.l  d3,d7
  245.   LSR.l #1,d6
  246.   LSR.l #1,d7
  247.   EOR.l d0,d6
  248.   EOR.l d1,d7
  249.   AND.l d4,d6
  250.   AND.l d4,d7
  251.   EOR.l d6,d0
  252.   EOR.l d7,d1
  253.   MOVE.l  d1,c2pBPLSIZE*2(a2)
  254.   ADD.l d6,d6
  255.   ADD.l d7,d7
  256.   EOR.l d6,d2
  257.   EOR.l d7,d3
  258.  
  259.   EXG a5,d0
  260.   EXG d5,d1
  261.   EXG a4,d2
  262.   EXG a6,d3
  263.  
  264.   MOVE.w  d2,d6     ; Swap 16x4, parts 2 & 4
  265.   MOVE.w  d3,d7
  266.   MOVE.w  d0,d2
  267.   MOVE.w  d1,d3
  268.   SWAP  d2
  269.   SWAP  d3
  270.   MOVE.l  a6,c2pBPLSIZE(a2)
  271.   MOVE.w  d2,d0
  272.   MOVE.w  d3,d1
  273.   MOVE.w  d6,d2
  274.   MOVE.w  d7,d3
  275.  
  276.   MOVE.l  #$33333333,d4   ; Swap 2x4, parts 2 & 4
  277.   MOVE.l  d2,d6
  278.   MOVE.l  d3,d7
  279.   LSR.l #2,d6
  280.   LSR.l #2,d7
  281.   EOR.l d0,d6
  282.   EOR.l d1,d7
  283.   AND.l d4,d6
  284.   AND.l d4,d7
  285.   EOR.l d6,d0
  286.   EOR.l d7,d1
  287.   LSL.l #2,d6
  288.   LSL.l #2,d7
  289.   MOVE.l  a5,(a2)+
  290.   EOR.l d6,d2
  291.   EOR.l d7,d3
  292.  
  293.   MOVE.l  #$00ff00ff,d4   ; Swap 8x2, parts 2 & 4
  294.   MOVE.l  d1,d6
  295.   MOVE.l  d3,d7
  296.   LSR.l #8,d6
  297.   LSR.l #8,d7
  298.   EOR.l d0,d6
  299.   EOR.l d2,d7
  300.   AND.l d4,d6
  301.   AND.l d4,d7
  302.   EOR.l d6,d0
  303.   EOR.l d7,d2
  304.   LSL.l #8,d6
  305.   LSL.l #8,d7
  306.   MOVE.l  a4,-c2pBPLSIZE-4(a2)
  307.   EOR.l d6,d1
  308.   EOR.l d7,d3
  309.  
  310.   MOVE.l  #$55555555,d4   ; Swap 1x2, parts 2 & 4
  311.   MOVE.l  d1,d6
  312.   MOVE.l  d3,d7
  313.   LSR.l #1,d6
  314.   LSR.l #1,d7
  315.   EOR.l d0,d6
  316.   EOR.l d2,d7
  317.   AND.l d4,d6
  318.   AND.l d4,d7
  319.   EOR.l d6,d0
  320.   EOR.l d7,d2
  321.   ADD.l d6,d6
  322.   ADD.l d7,d7
  323.   EOR.l d6,d1
  324.   EOR.l d7,d3
  325.  
  326.   MOVE.l  d0,d7
  327.   MOVE.l  d1,d4
  328.   MOVE.l  d2,a5
  329.   MOVE.l  d3,a6
  330.  
  331.   CMP.l a0,a3
  332.   BNE _x
  333. _xend
  334.  
  335.   MOVE.l  d7,c2pBPLSIZE*2(a1)
  336.   MOVE.l  d4,c2pBPLSIZE(a1)
  337.   MOVE.l  a5,(a1)+
  338.   MOVE.l  a6,-c2pBPLSIZE-4(a1)
  339. _none
  340.   MOVEM.l (a7)+,a3-a6
  341. AsmExit
  342.  
  343.   Even4
  344. c2p_data
  345. c2p_screen: Dc.l 0
  346. c2p_scroffs: Dc.l 0
  347. c2p_pixels: Dc.l 0
  348.   Ds.l  16
  349. End Statement
  350.  
  351.  
  352.  
  353.  
  354. .blitzprogram
  355. ; Setup
  356. InitBank 0,(#scrwidth*#scrheight)+1000,2|65536 ; Chipram planar buffer
  357. CludgeBitMap 0,#scrwidth,#scrheight,8,Bank(0)
  358. InitPalette 0,256
  359. For c=0 To 255
  360.   AGAPalRGB 0,c,Rnd(c),Rnd(c),Rnd(c)
  361. Next c
  362. AGAPalRGB 0,0,0,0,0
  363. Screen 0,0,0,#scrwidth,#scrheight,8,0,"c2p test",0,0,0
  364. Use Palette 0
  365. VWait 50
  366. baseaddress1.l=AllocMem(#scrwidth*#scrheight,$10000) ; Fastram chunky buffer
  367.  
  368. ; Put something into the chunky buffer so we can see it working
  369. GetReg a0,baseaddress1
  370. MOVE.l  #0,d0
  371. MOVE.l  #screensize-1,d1
  372. cloop
  373.   MOVE.b  d0,(a0)+
  374.   ADDQ.l  #1,d0
  375.   SUBQ.l  #1,d1
  376.   TST.l   d1
  377.   BLT     done
  378.   BRA     cloop
  379. done
  380.  
  381. ; Do the c2p test
  382. c2p060onlyinit{#scrwidth,#scrheight}
  383. VWait 20
  384. Forbid_
  385. VWait
  386. ResetTimer
  387. For time=1 To 800
  388.   c2p060only{baseaddress1,Bank(0)} ; Convert chunky to planar
  389. Next time
  390. t=Ticks
  391. VWait 2 : Permit_
  392. VWait 20
  393. FindScreen 0
  394. Window 0,0,11,640,100,0,"Test results for c2p",0,0
  395. WindowOutput 0
  396. NPrint "Routine performed @ ",50/(t/800),"fps - ",t," ticks"
  397. NPrint " "
  398. NPrint "Press mousebutton..."
  399. Free Screen 0
  400. MouseWait
  401. Free Window 0
  402. End
  403.  
  404.